package com.paw.portal.response.dto;

import java.io.Serializable;
import java.util.Date;

import cn.hutool.core.date.DatePattern;
import com.fasterxml.jackson.annotation.JsonFormat;
import com.fasterxml.jackson.databind.annotation.JsonSerialize;
import com.fasterxml.jackson.databind.ser.std.ToStringSerializer;
import com.paw.portal.enums.SysRoleEnums;
import com.paw.portal.enums.SysRoleEnums.DataScopeEnum;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import lombok.EqualsAndHashCode;
import lombok.experimental.Accessors;

/**
 * <p>
 * 角色信息表
 * </p>
 *
 * @author Rubble
 * @since 2021-08-21
 */
@Data
@EqualsAndHashCode(callSuper = false)
@Accessors(chain = true)
@ApiModel(value="SysRoleResponseDto对象", description="角色信息表响应对象")
public class SysRoleResponseDto implements Serializable {

    private static final long serialVersionUID = 1L;

    @ApiModelProperty(value = "角色ID")
    @JsonSerialize(using= ToStringSerializer.class)
    private Long id;


    @ApiModelProperty(value = "角色名称")
    private String name;


    @ApiModelProperty(value = "角色权限字符串")
    private String roleKey;


    @ApiModelProperty(value = "显示顺序")
    private Integer sortNum;


    @ApiModelProperty(value = "数据范围（1：全部数据权限 2：自定数据权限 3：本部门数据权限 4：本部门及以下数据权限）")
    private Integer dataScope;

    @ApiModelProperty(value = "数据范围")
    private String dataScopeDesc;

    @ApiModelProperty(value = "角色状态（0：禁用；1：正常）")
    private Integer status;

    @ApiModelProperty(value = "角色状态")
    private String statusDesc;

    @ApiModelProperty(value = "备注")
    private String remark;


    @ApiModelProperty(value = "删除标志 1是")
    private Integer delFlag;


    @ApiModelProperty(value = "创建者")
    private String createBy;


    @ApiModelProperty(value = "创建时间")
    @JsonFormat(pattern = DatePattern.NORM_DATETIME_PATTERN)
    private Date createTime;


    @ApiModelProperty(value = "更新者")
    private String updateBy;


    @ApiModelProperty(value = "更新时间")
    @JsonFormat(pattern = DatePattern.NORM_DATETIME_PATTERN)
    private Date updateTime;

        
  public String getDataScopeDesc () {
    return DataScopeEnum.getDescByCode(dataScope);
  }
        
  public String getStatusDesc () {
    return SysRoleEnums.StatusEnum.getDescByCode(status);
  }
}
